#
# Date strings for DL4:
# 
# 20120929 - single date
# 20120927,20120929 - list of dates
# 20120927-20120929 - range of dates
#

import re

pattern_single = '^\d{8}$'
pattern_list = '^\d{8}(,\d{8})+$'
pattern_between = '^\d{8}-\d{8}$'

date_string = '20120927-20120930'

if re.search(pattern_single, date_string):
    print 'single pattern'
elif re.search(pattern_list, date_string):
    print 'list pattern'
    date_list = date_string.split(',')
    print 'date list: %s' % date_list
elif re.search(pattern_between, date_string):
    print 'between pattern'
    date_list = date_string.split('-')
    print 'date list: %s' % date_list
else:
    print 'no pattern'
